package org.example.nio2.server.controller;


import io.netty.channel.Channel;
import org.example.nio2.utils.BeanUtil;
import org.example.nio2.vo.MsgRequest;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author liyishan
 * @date 2023/11/13 15:35
 * @apiNote
 */
@RestController
@ResponseBody
public class MessageSendController {

    @RequestMapping("/message")
    @ResponseBody
    public void doSendMsg(String userId, String talkId, String msg) {
        Channel channel = BeanUtil.getBean("channel", Channel.class);
        channel.writeAndFlush(new MsgRequest(talkId, userId, msg));

    }
}
